/*
 * @Description: 最大公约数
 * @Author: zzj
 * @Date: 2021-08-30 16:17:01
 * @LastEditors: zzj
 * @LastEditTime: 2021-09-01 17:18:13
 */

//最大公约数
const readline = require('readline-sync')
var input = readline.question("please input two number,and use speace:");
console.log(input);
var a = input.split(' ')[0];
var b = input.split(' ')[1];
console.log(gys(a,b));
function gys(a,b){
        if(a<b){
            c = b;
        }
        else{
            c = a;
        }
        for(i=c;i>0;i--){
                if(a % i ===0 && b % i ===0){
                        return i;
                }
        }
}